﻿<?php
	session_start();
    include_once("template/DataProvider.php");
    $query = "SELECT * FROM giaodien";
    $result = DataProvider::ExecuteQuery($query);
    $row = mysql_fetch_array($result);
?>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="author" content="group30" />

	<title>TechMart</title>
     <link type="text/css" rel="stylesheet" href="css/index.css"/>
     
     <!--menu -->
     <link type="text/css" href="css/menu.css" rel="stylesheet" />
     <!--slide -->
     <link rel="stylesheet" href="css/silde.css" type="text/css"  />
     <!--Map-->
     <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&language=vi"></script>
     <script type="text/javascript" src="js/map.js"></script>
     <!--Chart-->
     <script type="text/javascript" src="js/jscharts.js"></script>
     
     <!--Ngoai Te-->
     <link rel="stylesheet" href="css/tygia_thoitiet.css"  type="text/css" />
     <script language="javascript" type="text/javascript" src="js/thuvien.js"></script>
     
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/scripts.js"></script>
    <script type="text/javascript" src="js/myScript.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#main-contain').append();
           $(window).scroll(function() {
            if($(window).scrollTop() != 0) {
                $('#top').fadeIn();
            } else {
                $('#top').fadeOut();
            }
           });
           $('#top').click(function() {
            $('html, body').animate({scrollTop:0},1200);
           });
        });
</script> 

</head>

<body bgproperties="fixed"  <?php
            if($row['bodybg'] != 1)
                echo 'style="background-image: url(./img_admin/'.$row['bodybg'].');"'; 
        ?>>
    <div id="Header" >
        <?php include('template/header.php');?>
    </div><!-- end Header 2 button đăng ký -  đăng nhập-->
    
    
    <!--
    	<div id="Banner">
        <?php// include('template/banner.php'); ?>
    </div> 
    -->
    <div id="Slide"> 
        	<?php include('template/slide.php'); ?>
        </div><!-- end slide ( chạy hình )-->
    
   	<div id="top_menu">
   		<?php include('template/top_menu.php'); ?>
   	</div>
   
    <div id="Container">
    	
        <div id="RightContent"  <?php
            include_once("template/DataProvider.php");
            $query = "SELECT * FROM giaodien";
            $result = DataProvider::ExecuteQuery($query);
            $row = mysql_fetch_array($result);
            if($row['vitri'] != 1)
                echo 'style="float: left;"'; 
        ?> style="width: 250px;">
        	<?php include('template/rightcontent.php'); ?>
        </div><!--end Right content-->
        
        
        
        <!--------------------------------Nội dung-------------------------------------->
        	<!--------------------------------------------------------------------->
            
        <div id="MainContent" <?php
            include_once("template/DataProvider.php");
            $query = "SELECT * FROM giaodien";
            $result = DataProvider::ExecuteQuery($query);
            $row = mysql_fetch_array($result);
            if($row['mainbg'] != 1)
                echo 'style="background-image: url(./img_admin/'.$row['mainbg'].');"';
        ?> >
        	<?php
                // khi có yêu cầu search sp
                if(isset($_REQUEST["key"]) == true)
                {
                    include("pages/pSearchSP.php");
                }
                else
                {
                if(isset($_REQUEST["key2"]))
                {
                    include("pages/pSearchNC_Output.php");
                                    
                }                                                                                   
                else
				{
				
                //Xu ly bien act luc load trang
				if(isset($_REQUEST["act"]) == false)
				{
					$act = 1;	
				}
				else
				{
					$act = $_REQUEST["act"];	
				}
				switch($act)
				{
				   
					case 1: 
						include("pages/pIndex.php");
						break;
					case 2:
						include("pages/pSanPhamTheoHangSanXuat.php");
						break;
					case 3:
						include("pages/pSanPhamTheoLoai.php");
						break;
					case 4:
						include("pages/pChiTietSanPham.php");
						break;
                        
					case 5:
						include("pages/pDangKyTaiKhoan.php");
						break;
                       
					case 6:
						include("pages/pErrorDangNhap.php");
						break;
					case 7:
						include("pages/pQuanLyGioHang.php");
						break;
					case 8:
						include("pages/pDatHangThanhCong.php");
						break;
                    case 9:
                        //kiểm tra nếu chưa đăng nhap thì k cho vào đây
                        if(isset($_SESSION["TenHienThi"]) == true)
                        { 
                            include("pages/pProfileUser.php");
                            break;
                        }
                        else include("pages/pIndex.php");
                        break;
					case 10:
                        if(isset($_SESSION["MaTaiKhoan"]) == true)
                        include("pages/pDangsp.php");
                        break;
                    case 11:
                        include("pages/pSuasp.php");
                        break;
                    case 12:
                        include("pages/xlSuasp.php");
                        break;	
                    case 13:
                        include("pages/xlComment.php");
                        break;
                    case 15:
                        include("pages/xlXoasp.php");
                        break;
                    case 16:
                        include("pages/xlXoaComment.php");
                        break;
                    case 18:
                        include("pages/pSearchNangCao.php");
                        break;
                    case 20:
                        include("pages/xlCheckGiaoHang.php");
                        break;    
					default:
						include("pages/pIndex.php");
				}
                }                
                
                }
				
			?>
        </div><!--end Main content -->
        
        	<!--------------------------------------------------------------------->
       <!------------------------------------------------------------------------------->
        
        
        
    </div><!-- end Container-->
    
    <div id="spHot">
        <?php include('template/spHot.php') ?>
    </div>
    
    <div id="Footer"><br />
        <?php include('template/footer.php') ?>
    </div><!-- end Footer-->
    
    <a class="toTop"  id="top" href="#" >
    <img src="images/top.png"/>
    </a>
</body>
</html>